import pygame
import sys
import random

screen = pygame.display.set_mode((800,480))
pygame.display.set_caption("捕鱼达人")
screen.fill((255,0,0))


bg = pygame.image.load("images/bg.jpg")
fish8 = pygame.image.load("images/fish8_0.png")


def handle_event():
   for i in pygame.event.get():
       if i.type == pygame.QUIT:
           pygame.quit()
           sys.exit()




x = 200
y = 200
xn = 0.1
yn = 0.1
while True:
    if x <= 0:
        xn = -xn
    if y >= 480:
        yn = -yn

    if x >= 800:
            xn = -xn
    if y <= 0:
        yn = -yn

    screen.blit(bg,(0,0))
    screen.blit(fish8,(x,y))
    x = x - xn
    y = y + yn
    handle_event()
    pygame.display.update()